<template>
    <div class="header">
        <van-button custom-class="signDesk " open-type="getUserInfo" @getuserinfo="bindGetUserInfo" class="appppp"><img src="../../static/images/redbao.png" alt=""> 签到</van-button>
        <div class="search">
            <van-search
            v-model="value"
            placeholder="输入搜索内容"
            background="#ffffff"
            shape="round"
            @click="onSearch"
            :readonly="true"
            :disabled="false"
            >
            </van-search>
        </div>
        <div class="location" >
            <img src="/static/images/adr.png" alt=""/>
            <span >{{address}}</span>
        </div>
    </div>
</template>

<script>
import amapFile from "@/utils/amap-wx";
import { xdLogin } from "@/utils/login"
export default {
  props: ["address"],
  methods: {
    signDesk() {
      console.log(1);
      let url = "../signDesk/main";
      mpvue.navigateTo({ url });
    },
    toPosition() {
      console.log(1);
      let url = "../position/main";
      mpvue.navigateTo({ url });
    },
    onSearch(){
       console.log(1);
      let url = "../serch/main";
      mpvue.navigateTo({ url });
    },

    bindGetUserInfo(e){
      wx.getStorage({
            key: 'token',
            success: (result) => {
                this.signDesk()
            },
            fail: () => {
                xdLogin(e).then((res)=>{
                    this.signDesk()
                })
            },
            complete: () => {}
        });
    },
    getAdrInfo() {
      
    },
  },
};
</script>
<style lang="scss" >
.header {
  padding: 0 15px;
  display: flex;
  width: 100%;
  box-sizing: border-box;
  display: -webkit-box;
  display: -webkit-flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;

  .van-cell {
    height: 32px;
    line-height: 32px;
    border-radius: 16px;
    width: 100%;
  }
  .search {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    .van-search__content {
      border: 1px solid #ddd;
      height: 32px;
      line-height: 32px;
      border-radius: 16px;
      width: 100%;
      background: #fff;
    }
  }

  .location {
    font-size: 14px;
    img {
      width: 14px;
      height: 17px;
      vertical-align: middle;
      margin-right: 4px;
    }
    span {
      display: inline-block;
      width: 43px;
      color: rgba(51, 51, 51, 1);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      vertical-align: middle;
    }
  }
  .signDesk {
    font-size: 14px;
    font-weight: 500;
    padding: 0;
    border: none;
    button::before{
      border: none;
    }
    button::after{
      border: none;
    }
    img {
      width: 22px;
      height: 19px;
      margin-right: 4px;
      vertical-align: middle;
    }
  }
}
</style>